import java.io.*;

public class Practice6_2 {
	public static void main(String[] args) throws IOException {
		long filePoint = 0;
		int i;
		RandomAccessFile file = new RandomAccessFile("mid2.txt", "rw");
		
		for(i = 1000; i < 1010; i++) {
			file.writeInt(i);
		}
	
		long fileLength = file.length();
		file.seek(0);
		while(filePoint < fileLength) {
			i = file.readInt();
			System.out.print(i+" ");
			filePoint = file.getFilePointer();
		}
		file.close();
	}
}
